package com.wuotng.xsxx.jbxx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wuotng.common.annotation.Log;
import com.wuotng.common.core.controller.BaseController;
import com.wuotng.common.core.domain.AjaxResult;
import com.wuotng.common.enums.BusinessType;
import com.wuotng.xsxx.jbxx.domain.Jbxx;
import com.wuotng.xsxx.jbxx.service.IJbxxService;
import com.wuotng.common.utils.poi.ExcelUtil;
import com.wuotng.common.core.page.TableDataInfo;

/**
 * 学籍信息Controller
 * 
 * @author ruoyi
 * @date 2025-05-13
 */
@RestController
@RequestMapping("/xsxx/jbxx")
public class JbxxController extends BaseController
{
    @Autowired
    private IJbxxService jbxxService;

    /**
     * 查询学籍信息列表
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(Jbxx jbxx)
    {
        startPage();
        List<Jbxx> list = jbxxService.selectJbxxList(jbxx);
        return getDataTable(list);
    }

    /**
     * 导出学籍信息列表
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:export')")
    @Log(title = "学籍信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Jbxx jbxx)
    {
        List<Jbxx> list = jbxxService.selectJbxxList(jbxx);
        ExcelUtil<Jbxx> util = new ExcelUtil<Jbxx>(Jbxx.class);
        util.exportExcel(response, list, "学籍信息数据");
    }

    /**
     * 获取学籍信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:query')")
    @GetMapping(value = "/{jbxxId}")
    public AjaxResult getInfo(@PathVariable("jbxxId") String jbxxId)
    {
        return success(jbxxService.selectJbxxByJbxxId(jbxxId));
    }

    /**
     * 新增学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:add')")
    @Log(title = "学籍信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@Validated @RequestBody Jbxx jbxx)
    {
        return toAjax(jbxxService.insertJbxx(jbxx));
    }

    /**
     * 修改学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:edit')")
    @Log(title = "学籍信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody Jbxx jbxx)
    {
        return toAjax(jbxxService.updateJbxx(jbxx));
    }

    /**
     * 删除学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:jbxx:remove')")
    @Log(title = "学籍信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jbxxIds}")
    public AjaxResult remove(@PathVariable String[] jbxxIds)
    {
        return toAjax(jbxxService.deleteJbxxByJbxxIds(jbxxIds));
    }
}
